﻿using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Api.Common;

namespace Api.Web
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            Error += MvcApplication_Error;
        }

        private void MvcApplication_Error(object sender, System.EventArgs e)
        {
            var ex = HttpContext.Current.Server.GetLastError();
            LogHelper.WriteErrorLog(ex.Message ?? "");
        }

        protected void Application_BeginRequest()
        {
        }

        protected void Application_EndRequest()
        {
        }
    }
}
